/*
模拟 贪心
总是去除最大的那个
*/
#include<bits/stdc++.h>
using namespace std;
int cha[1100],n,k,a[1100],len,fir=1;
struct node
{
    int num;
    int cishu;
}muli_cha[1100];
inline bool cmp(int x,int y){
    return x>y;
}
void quchong(){
    muli_cha[++len].num=cha[1];
    muli_cha[len].cishu=1;
    for(int i=2;i<=n;i++){
        if(cha[i]==cha[i-1])
            muli_cha[len].cishu++;
        else {
            muli_cha[++len].num=cha[i];
            muli_cha[len].cishu=1;
        }
    }
} 
int main(){
    int k1,k2;
    scanf("%d%d%d",&n,&k1,&k2);
    k=k1+k2;
    for(int i=1;i<=n;i++)
        scanf("%d",&a[i]);
    for(int i=1,j;i<=n;i++){
        scanf("%d",&j);
        cha[i]=abs(j-a[i]);
    }
    sort(cha+1,cha+1+n,cmp);
    quchong();
    for(int i=1;i<=len;i++){
        int need_k=muli_cha[i].cishu*(muli_cha[i].num-muli_cha[i+1].num);
        if(k>=need_k){
            k-=need_k;
            muli_cha[i+1].cishu+=muli_cha[i].cishu;
            fir=i+1;
        }
        else{
            int jian_num=k/muli_cha[i].cishu;
            muli_cha[i].num-=jian_num;
            k-=jian_num*muli_cha[i].cishu;
            muli_cha[len+1].cishu=k;
            muli_cha[len+1].num=muli_cha[i].num-1;
            muli_cha[i].cishu-=k;
            k=0;
            break;
        }
    }
    if(k&1)muli_cha[len+1].num=1,muli_cha[len+1].cishu=1;
    long long ans=0;
    for(int i=fir;i<=len+1;i++)
    ans+=1LL*muli_cha[i].cishu*muli_cha[i].num*muli_cha[i].num;
    printf("%lld",ans);
}